use criterion::{criterion_group, criterion_main, Criterion};
use simple_alloc::simple_alloc::*;
use std::alloc::Layout;

fn malloc_benchmark(c: &mut Criterion) {
    c.bench_function("malloc", |b| {
        b.iter(|| {
            let layout = Layout::from_size_align(1024 * 1024 * 1024, 1).unwrap();
            let ptr = unsafe { malloc(layout) };
            unsafe { dealloc(ptr, layout) };
        })
    });
}

criterion_group!(benches, malloc_benchmark);
criterion_main!(benches);
